//index.js
//获取应用实例
const app = getApp()
Page({
  data: {
    background: ["swiper-text-1","swiper-text-2","swiper-text-3"],
    indicatorDots: true,
    circular: true,
    autoplay: true,
    interval: 3000,
    duration: 500
  },
  onLoad: function (options) {
    var that=this;
    wx.request({
      url: app.globalData.host +'Essay/essay_list/10',
      method:'GET',
      success:function(res){
        res.data = res.data.map((val) => {
          val.create_time = val.create_time.slice(0, 11)
          return val
        })
        that.setData({
          blogList : res.data
        })
      }
    });
  },
  toDetail:function(e){
    var index=e.currentTarget.dataset.index;
    let id = this.data.blogList[index].id
    wx.navigateTo({
      url: '/pages/content/content?id='+id,
    })
  },         
  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function (res) {
  }
})

